package chapter04;

/**
 * 从字符串中分离文件路径、文件名和拓展名
 * Created by a on 2017/6/9.
 */
public class Test078 {
    public static void main(String[] args) {
//        String path = "D\\123.txt";
//        int spiltIndex = path.indexOf("D");
//        System.out.println(spiltIndex);
//        int typeIndex = path.lastIndexOf("2");
//        System.out.println(typeIndex);
//        if (typeIndex < 0){
//            typeIndex = path.length();
//        }
//        String filePath = path.substring(0,spiltIndex);
//        String fileName = path.substring(spiltIndex+1,typeIndex);
//        String exName = path.substring(typeIndex);
//        System.out.println("文件路径:"+filePath);
//        System.out.println("文件名:"+fileName);
//        System.out.println("文件拓展名:"+exName);
        String str = "abcdecfg";
        System.out.println(str.substring(1,2));
    }
}
